%
3
7
1
38
Now run the program and see if you
can figure out how it works.
^
%
3
7
1
38
Go ahead, enter your favorite
number,
^
%
3
10
1
38
The computer accepted your number
and then printed it on the screen
with a message.  Have you figured
it out yet?  Press RETURN to see a
listing of the program.
^
&
Here's the program.  As you may
have guessed, the INPUT statement
on line 20 is the key.  The INPUT
statement works like a mail
carrier.
^
&
When line 20 is executed, it types
a ? on the screen and waits for
you to type a number.
^
&
Then the program delivers whatever
number you type to the variable
name at the end of the INPUT
statement (in this case N).
^
&
Press RETURN for an explanation of
how all the lines work together
in this program.
^
%
3
9
1
38
(If you're thinking that this is
how the computer can ask for and
remember your name, you're on the
right track!)
^
&
Up to now, we've been using
NUMERIC variables--variables that
store numbers.
^
%
3
13
1
38
Actually, there are two types of
variables:

NUMERIC variables only store
       numbers.

STRING variables store strings of
       characters, like names.
^
%
3
10
1
38
Fortunately, you don't have to be
a computer genius to be able to
tell one type from the other.
^
&
String variables have a dollar
sign ($) after them.  This makes
it very easy for the INPUT
"mail carrier" to find the right
place to store your information.
^
%
3
8
1
38
So, the name N signifies a numeric
variable, and N$ signifies a
string variable.
^
&
It's time to share the secret with
you. Let's look at a program that
makes use of a string variable.
^
&
Line 20 is an INPUT statement with
a string variable (notice the $
after the variable name).
^
%
3
10
1
38
Line 40 works the same way as the
last PRINT statement worked,
except it prints a string variable
instead of a numeric variable.
^
&
Yes, that's the secret.  It may
look simple (and it is), but this
is how computers ask for and
remember your name!
^
&
Would you like to see what
this program does when it
runs? (Y/N)
^
%
3
8
1
38
Please erase this program from
memory so that we can help you
write one more program.
^
%
3
8
1
38
Very good!  You certainly do
catch on to this computer stuff
fast,
^
%
3
11
1
38
OK, we've typed in a five-line
program that asks for your
favorite flavor of ice cream.  But
something's missing.  Do you know
what it is?
^
&
Of course!  There's no INPUT
statement on line 20.  Why don't
you add the INPUT statement.
(Please use the string variable
I$ since the PRINT statement on
line 30 is already written.)
^
%
3
8
1
38
Your program is complete.  Why
don't you list it so you can
admire your handiwork.
^
%
3
7
1
38
Now try running it.

^
%
3
9
1
38
Very good!  It did just what it
was supposed to do.  Would you
like an explanation of how the
program works? (Y/N)
^
%
3
10
1
38
You're well on your way to
becoming an Applesoft BASIC
programmer.
^
&
Of course, there is much more to
learn.  You can learn how to use
loops to move around inside your
program and how to draw pictures
on the screen.
^
&
Now that you understand the
fundamental steps, you'll just
get better the more you practice.
^
&
The book "A Touch of Applesoft
BASIC" can teach you more about
programming.  So good luck, and
happy programming!
^
